package com.lyk.coursearrange.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lyk.coursearrange.entity.CustomerInformation;
import com.lyk.coursearrange.entity.Sale;
import com.lyk.coursearrange.entity.dto.CustomerInformationDto;
import com.lyk.coursearrange.entity.dto.CustomerInformationDtoTwo;
import io.swagger.models.auth.In;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CustomerInformationDao extends BaseMapper<CustomerInformation> {

    CustomerInformation getById(Long id);
    String getsourcename(@Param("customerId") Long customerId);

    List<CustomerInformation> customerinformationlist(@Param("customer_student") String customer_student, @Param("page") Long offset, @Param("limit") Long limit, @Param("customerAccount")String customerAccount, @Param("customerWx")String customer_wx, @Param("customerState") Long customer_state, @Param("customerType")Long customerType, @Param("customerIsactive")Long customer_isactive, @Param("type")Integer type);
    @Select("select current_value from sequence")
    Long selectsequence();

    boolean customerinformationadd(@Param("c") CustomerInformation customerInformation);
    @Select("select count(*) from tb_customer_information where customer_account = '杨老师'")
    Long selectcounta();


    @Select("select count(*) from tb_customer_information where customer_account = '苏老师'")
    Long selectcountb();

    CustomerInformationDtoTwo customersone(@Param("customer_id") Long customer_id);

    int selectWX(@Param("wx") String wx);

    Long customerinformationcount(@Param("customer_student") String customer_student,@Param("customerAccount")String customerAccount,@Param("customerWx")String customer_wx,@Param("customerState") Long customer_state,@Param("customerType")Long customerType,@Param("customerIsactive")Long customer_isactive,@Param("type")Integer type);
//    @Select("SELECT a.*, b.*, c.* FROM customer a " +
//            "LEFT JOIN payment b ON a.id = b.customer_id " +
//            "LEFT JOIN installment c ON a.id = c.customer_id " +
//            "WHERE a.id = #{customerId}")
//    @Results({
//            @Result(column = "id", property = "customer.id"),
//            @Result(column = "name", property = "customer.name"),
//            @Result(column = "amount", property = "payment.amount"),
//            @Result(column = "installment_amount", property = "installment.amount")
//    })
//    List<CustomerInformation> getCustomerDetailsWithPaymentAndInstallment(@Param("customerId") Long customerId);


    String selectsmall();

    Long selectorder_number(@Param("admin_no") String admin_no);

    void updatealgorithm(@Param("admin_no") String admin_no, @Param("order_number") Long b);

    List<CustomerInformation> customerinformationlisttwo(@Param("customer_student") String customer_student, @Param("page") Long offset,@Param("limit") Long limit,@Param("sourcepeople_id")Long sourcepeople_id,@Param("customerWx")String customer_wx,@Param("customerState") Long customer_state,@Param("customerType")Long customerType,@Param("customerIsactive")Long customer_isactive, @Param("type")Integer type);

    Long customerinformationcounttwo(@Param("customer_student") String customer_student,@Param("sourcepeople_id")Long sourcepeople_id,@Param("customerWx")String customer_wx,@Param("customerState") Long customer_state,@Param("customerType")Long customerType,@Param("customerIsactive")Long customer_isactive,@Param("type")Integer type);

    String selectmax();

    Long getsourcepeople_id(@Param("customer_account") String customer_account);

    Long getuser_type(@Param("customer_account") String customer_account);

    List<Sale> customersale();
}
